package io._520;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.Random;

public class Test1 {
    public static void main(String[] args) {
        List<Integer> list=new ArrayList<>();
        Random ran=new Random();
        for(int i=0;i<5;i++){
            list.add(ran.nextInt(101));
        }
        System.out.println(list);
        boolean allMatch = list.stream().allMatch(e -> e >= 60);
        System.out.println("该学生是否全部及格？"+allMatch);
        boolean b1 = list.stream().noneMatch(e -> e >=60);
        System.out.println("该学生是否全部不及格？"+b1);
//        Optional<Integer> sum = list.stream().reduce((a, b) -> a + b);
//        System.out.println("该学生成绩总和为："+sum.get());
        int sum=list.stream().reduce((a, b) -> a + b).get();
        System.out.println("该学生成绩总和为："+sum);

    }
}
